#ifndef COLLISION_MGR_H
#define COLLISION_MGR_H

#include "MyScene.h"
#include "CollectableItemsList.h"

class MyScene;

class CollisionManager
{
public:
	CollisionManager();
	~CollisionManager();


	void copyToStaticObjArray (CollectableItemsList* itemsList);
	void copyToStaticObjArray (GameEntity** objArray, int numElements);
	void copyToDynamicObjArray(GameEntity** objArray, int numElements);
	void copyToDynamicObjArray(GameEntity** objArray, int numElements, GameEntity* nPlayer);

	GameEntity* getStaticObj (int objIndex);
	GameEntity* getDynamicObj(int objIndex);

	int staticObjArraySize() {return mStaticArraySize; }
	int dynamicObjArraySize(){return mDynamicArraySize;}

	void update(MyScene* scene);

private:
	/*Character** mCharList;//the dynamic ones are probably characters
	CollectableItemsList* mItemsList;*/
	GameEntity** mStaticObjectsArray;//obj that cannot change position
	GameEntity** mDynamicObjectsArray;//obj that can change position
	//	,mGhostArray	//ghosts between them cannot collide (in the same way behaves pac-mans)
	//	,mPacManArray

	int mDynamicArraySize, 
		mStaticArraySize;

	void deleteStaticObjArray();
	void deleteDynamicObjArray();


	GameEntity* getStaticObjCollidingWith(GameEntity* entity);
	bool areColliding(GameEntity* entityA, GameEntity* entityB);

	//if implemented a specialized class to manage the arrays the following methods can be moved there
	void deleteArray(GameEntity** &array);
	void copyArray(GameEntity** &arrayTo, GameEntity** arrayFrom, int numElements);
																		//isDynamic is a flag to point which list I'm using
	bool insertInArray(GameEntity* newEntity, int pos, bool isDynamic); //true if inserted successfully
	bool insertInArray(GameEntity* newEntity, int pos, GameEntity** &arrayTo, int arraySize);
};

#endif //COLLISION_MGR_H